from rest_framework import serializers
from .models import Endpoint,Case


class EndpointSerializer(serializers.ModelSerializer):
    # params = serializers.JSONField(required=False, allow_null=True)
    class Meta:
        model = Endpoint
        fields = '__all__'  # 取model中所有的字段。如果只是取部分，就 ("a","b") 元组的方式


class CaseSerializer(serializers.ModelSerializer):
    endpoint_info = EndpointSerializer(source="endpoint", read_only=True, allow_null=True)

    class Meta:
        model = Case
        fields = '__all__'  # 取model中所有的字段。如果只是取部分，就 ("a","b") 元组的方式

